import axios from '@/libs/api.request'

export const getModuleNames = (val) => {
  return axios.request({
    url: 'api/HttpAutoTestService/module/names/',
    params: val,
    method: 'get'
  })
};

export const getModules = (val) => {
  return axios.request({
    url: 'api/HttpAutoTestService/modules/',
    params: val,
    method: 'get'
  })
};

export const createModule = (module) => {
  return axios.request({
    url: 'api/HttpAutoTestService/module/',
    data: module,
    method: 'post'
  })
};

export const deleteModule = (id) => {
  return axios.request({
    url: `api/HttpAutoTestService/module/${id}/`,
    method: 'delete'
  })
};

export const updateModule = (module) => {
  return axios.request({
    url: `api/HttpAutoTestService/module/${module.id}/`,
    data: module,
    method: 'put'
  })
};

export const moveModule = (data) => {
  return axios.request({
    url: 'api/HttpAutoTestService/module/move/',
    data: data,
    method: 'post'
  })
};
